﻿<Window x:Class="OpenPOS.Modules.Sales.Views.PaymentsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:OpenPOS.Modules.Sales.ViewModels"
        Title="Payments" Height="500" Width="500" WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        

        <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="5,5,5,0" HorizontalAlignment="Center">
            <TextBlock Text="Total: " Foreground="{DynamicResource TextBrush}" VerticalAlignment="Center" />  
            <TextBox Text="{Binding Ticket.Total, StringFormat='R0.00', Mode=OneWay}" Width="100"  />
            <TextBlock Text="Remaining: " Foreground="{DynamicResource TextBrush}" Margin="10,0,0,0" VerticalAlignment="Center" />
            <TextBox Text="{Binding Remaining, StringFormat='R0.00', Mode=OneWay}" Width="100"  />
            <Button Content="+" Width="20" Height="20" Margin="5,0,1.5,0" Command="{Binding AddPaymentCommand}"/>
            <Button Content="-" Width="20" Height="20" Margin="1.5,0,1.5,0" IsEnabled="False"/>
        </StackPanel>
        
        <Border Background="{DynamicResource ShadeBrush}" BorderBrush="#AAAAAA" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4" Grid.Row="1" Margin="8,8,8,8">
            <TabControl ItemsSource="{Binding Methods}" SelectedIndex="0" TabStripPlacement="Left" DisplayMemberPath="PaymentMethod" SelectedItem="{Binding SelectedMethod, Mode=TwoWay}">
                <TabControl.Resources>
                    <DataTemplate DataType="{x:Type vm:PaymentMethodViewModel}">
                        <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            
                            <TextBlock Text="Value" Grid.Column="0" />
                            <TextBox Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" Width="100" Grid.Column="1" />
                        </Grid>                            
                    </DataTemplate>
                </TabControl.Resources>
            </TabControl>
        </Border>

        <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right" Margin="0,0,5,5">
            <Button Content="Ok" Width="80" Height="35" Margin="1.5,0,1.5,0" Command="{Binding ProcessPaymentCommand}">
            </Button>
            <Button Content="Cancel" Width="80" Height="35" Margin="1.5,0,1.5,0" IsEnabled="False">
            </Button>
        </StackPanel>
    </Grid>
</Window>

    